package br.gerador;

import java.util.List;


public abstract class GerarInsert {

	public static String gerarSql(String tabela, List<String> colunas, List<Object> valores) {
		try {
			StringBuilder update = new StringBuilder();
			update.append("insert into ").append(tabela).append("(");
			for (String coluna : colunas) {
				update.append(coluna).append(", ");
			}
			update.delete(update.length()-2, update.length()).append(")");
			if(valores != null && valores.size() > 0) {
				update.append(" values(");
				for (Object objeto : valores) {
					update.append(" ?, ");
				}
				update.delete(update.length()-2, update.length()).append(")");
			}

			return update.toString();
		} catch(Exception e) {
			e.printStackTrace();
			return null;
		}

	}

}
